package com.mensanyun.yminder.core.data

import androidx.compose.ui.graphics.Color


sealed class Node(val uid: String, var text: String)

class Topic(uid: String, text: String, var parentId: String? = null) : Node(uid, text) {
    private val subTopics = mutableMapOf<String, Topic>()
    fun addSubTopic(topic: Topic) {
        subTopics[topic.uid] = topic
        topic.parentId = uid
    }

    fun removeSubTopic(uid: String) {
        subTopics.remove(uid)
    }

    fun subtopics() = subTopics.toList()


    var fontProperties: FontProperties = FontProperties()
    var borderProperties: BorderProperties = BorderProperties()
    var layoutProperties = LayoutProperties()

    class LayoutProperties {
        var x: Float = 0f
        var y: Float = 0f
        var width: Int = 0
        var height: Int = 0
    }

    class BorderProperties {
        var borderWidth: Int = 1
        var borderColor: Color = Color.Black
        var borderLineType: LineType = LineType.SOLID
    }

    class FontProperties {
        var fontStyle: FontStyle = FontStyle.NORMAL
        var fontSize: Int = 12
        var fontFamily: String = "Arial"
        var fontColor: String = "black"
        var fontDecoration: String = "none"
    }
}

//class SubTopic(uid: String, var parentId: String, text: String) : Node(uid, text) {}


class Connection(val uid: String, val from: String, val to: String) {

    var lineProperties: LineProperties = LineProperties()


    class LineProperties {
        var lineStartStyle: LineEndStyle = LineEndStyle.NONE
        var lineEndStyle: LineEndStyle = LineEndStyle.NONE
        var lineType: LineType = LineType.SOLID
        var lineColor: String = "black"
        var lineWidth: Int = 1
        var fontStyle: FontStyle = FontStyle.NORMAL
        var fontSize: Int = 12
        var fontFamily: String = "Arial"
        var fontColor: String = "black"
        var fontDecoration: String = "none"


    }
}

enum class LineEndStyle {
    NONE, OPEN, TRIANGLE, TRIANGLE_OPEN
}

enum class LineType {
    SOLID, DASHED, DOTTED, DOUBLE, GROOVE, INSET, OUTSET, RIDGE, RIDGE_INSET, RIDGE_OUTSET, SOLID_INSET, SOLID_OUTSET, WAVED
}

enum class FontStyle {
    BOLD, ITALIC, NORMAL
}
